<script type="text/javascript">
$(function() {
	$("#theTable tr:even").addClass("stripe1");
	$("#theTable tr:odd").addClass("stripe2");
	$("#theTable tr").hover(
		function() {
			$(this).toggleClass("highlight");
		},
		function() {
			$(this).toggleClass("highlight");
		}
	);
});

$(document).ready(function() {
    
    $('table#theTable').each(function() {
        var currentPage = 0;
        var numPerPage = 10;
        var $table = $(this);
        $table.bind('repaginate', function() {
            $table.find('tbody tr').hide().slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).show();
        });
        $table.trigger('repaginate');
        var numRows = $table.find('tbody tr').length;
        var numPages = Math.ceil(numRows / numPerPage);
        var $pager = $('<div class="pager"></div>');
        for (var page = 0; page < numPages; page++) {
            $('<span class="page-number"></span>').text(page + 1).bind('click', {
                newPage: page
            }, function(event) {
                currentPage = event.data['newPage'];
                $table.trigger('repaginate');
                $(this).addClass('active').siblings().removeClass('active');
            }).appendTo($pager).addClass('clickable');
        }
        $pager.insertAfter($table).find('span.page-number:first').addClass('active');
    });
    
});

</script>

<?php
// www.contoh-ta.com
//author : asep setiawan & Team
include '../../inc/inc.koneksi.php';
ini_set('display_errors', 1); ini_set('error_reporting', E_ERROR);
$cari	= $_GET['cari'];

$where	= " WHERE LOWER(noinduk) LIKE '%" . strtolower($cari) . "%' OR LOWER(nama) LIKE '%" . strtolower($cari) . "%'";

echo "<table id='theTable' width='100%'>
		<thead>
                <tr>
			<th width='5%'>No</th>
			<th>Nomor Induk</th>
			<th>Nama</th>
			<th>L/P</th>
			<th>PAUD/TK</th>
			<th width='10%'>Aksi</th>
		</tr>
                </thead>
                <tbody>";
	$sql	= "SELECT * 
				FROM siswa
				$where
				ORDER BY noinduk";
	$query	= mysql_query($sql);
	
	$no=1;
	while($rows=mysql_fetch_array($query)){
		echo "<tr>
				<td align='center'>$no</td>
				<td align='center'>$rows[noinduk]</td>
				<td>$rows[nama]</td>
				<td align='center'>$rows[jenis_kelamin]</td>
				<td align='center'>$rows[pilihansekolah]</td>
				
				<td align='center' width='15%'>
                                <a href='#' onclick='prepareViewEdit(\"{$rows[noinduk]}\", false)'>View</a>
				<a href='#' onclick='prepareViewEdit(\"{$rows[noinduk]}\", true)'>Edit</a>
				<a href='#' onclick='prepareHapus(\"{$rows[noinduk]}\")'>Hapus</a>			
				</td>
			</tr>";
	$no++;
	}
echo "</tbody></table>";
?>